﻿<%@ Page Language="C#" AutoEventWireup="false" CodeFile="rptInvoiceViewer.aspx.cs" Inherits="SIPO.Web.Reports.rptInvoiceViewer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
    <link type="text/css" rel="stylesheet" href="<%= ResolveUrl("~/styles/ui.jqgrid.css") %>" />
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/i18n/grid.locale-id.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/jquery.jqGrid.min.js") %>"></script>
    <script src="<%= ResolveUrl("~/scripts/helper.js") %>" type="text/javascript"></script>
    <script type="text/javascript">


        $("#btnPrint").button({ icons: { primary: "ui-icon-print"} });

        $("#btnPrint").click(function () {
            var formUrl = '<%= ResolveUrl("~/reports/Transaction/rptPrintInvoice1.aspx") %>';
            var periodeAwal = $("#hfPeriodeAwal").val();
            var periodeAkhir = $("#hfPeriodeAkhir").val();
            var debtorID = $("#hfDebtorID").val();

            window.open(formUrl + "?periodeAwal=" + periodeAwal + "&periodeAkhir=" + periodeAkhir + "&debtorID=" + debtorID);            
        });
    </script>
    <script type="text/javascript">

        var handlerUrl = '<%= ResolveUrl("~/Ajaxhandler/Transaction/recInvoicehandler.ashx") %>';

        $('#table').jqGrid({
            url: handlerUrl + "?method=getdatareport",
            postData: {
                PeriodeAwal: function () { return $("#hfPeriodeAwal").val() },
                PeriodeAkhir: function () { return $("#hfPeriodeAkhir").val() },
                DebtorID: function () { return $("#hfDebtorID").val() }
                
            },
            datatype: 'json',
            colNames: ['No. Invoice', 'Nama Debitur', 'Tgl. Invoice', 'Nama Bank', 'Kode Akun', 'Invoice Value', 'Nama Sektor', 'Nama Sub Sektor', 'Nama Sub Sub Sektor'],
            colModel: [
           		{ name: 'InvoiceNo', index: 'InvoiceNo', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 240 },
                { name: 'recDebtor.DebtorName', index: 'DebtorName', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'InvoiceDate', index: 'InvoiceDate', align: 'center', width: 300, formatter: 'date', formatoptions: { newformat: 'd M Y'} },
                { name: 'recBankAccount.BankName', index: 'BankName', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'recBankAccount.AccountCode', index: 'AccountCode', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'InvoiceValue', index: 'InvoiceValue', width: 200, formatter: 'currency', formatoptions: { prefix: '', suffix: '', thousandsSeparator: ',' }, align: 'right' },
                { name: 'recSector.SectorName', index: 'SectorName', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'recSubSector.SubSectorName', index: 'SubSectorName', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 300 },
                { name: 'recSubSubSector.SubSubSectorName', index: 'SubSubSectorName', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 350 }
                
           	],
            rowNum: 10,
            id: 'InvoiceNo',
            multiselect: false,
            rowList: [5, 10, 15, 20],
            pager: '#pager',
            sortname: 'recInvoice.InvoiceNo',
            sortorder: "asc",
            viewrecords: true,
            jsonReader: { repeatitems: false },
            width: 980,
            height: '100%',
            caption: 'Aksi'
            
        });

        $("#table").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false },
        {}, {}, {}, { closeOnEscape: false, multipleSearch: false, closeAfterSearch: false });
        </script>

<body>
    <form id="form1" runat="server">
    <div>
        <button id="btnPrint" type="button">Cetak</button>
    </div>
    <br />
    
    <table id="table" class="scroll" cellpadding="0" cellspacing="0">
    </table>
    <div id="pager" class="scroll">
    </div>
    <asp:HiddenField ID="hfPeriodeAwal" runat="server" />
    <asp:HiddenField ID="hfPeriodeAkhir" runat="server" />
    <asp:HiddenField ID="hfDebtorID" runat="server" />
    </form>
</body>
</html>
